﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Layouts/List.Master" CodeBehind="DistributePlanDetailList.aspx.cs" Inherits="HHMMS.UI.Modules.PlanManager.DistributePlanDetailList" %>

<asp:Content ContentPlaceHolderID="head" ID="idFormTitle" runat="server">
   <title>配送计划详细管理</title> 
</asp:Content>

<asp:Content ID="idContent" ContentPlaceHolderID="Content" runat="Server">   
    <!-- 搜索框 -->
	<div class="search" style="margin-top:2px;">
        <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">            
            <SearchConditionTemplate>                                       
                <table cellpadding="0" cellspacing="0" width="95%">
			        <tr>
                        <th>
                            开始日期：
                        </th>
                        <td>
                            <web:DatePicker ID="dpCreateDtStart" Name="beginTime" runat="server" DateTimeFormat="yyyy-MM-dd"
                                validator="required"></web:DatePicker>
                            <asp:TextBox ID='MgID' runat='server' Text='<%# Bind("MgID") %>' Width='90%'
                            Visible="false"></asp:TextBox>
                        </td>
                        <th>
                            结束日期：
                        </th>
                        <td>
                            <web:DatePicker ID="dpCreateDtEnd" Name="endTime" runat="server" DateTimeFormat="yyyy-MM-dd"
                                validator="required"></web:DatePicker>
                        </td> 
                        <th>
                            备注：
                        </th>
                        <td>
                            <asp:TextBox ID="txtRemark" name="Remark" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>                                   
                    </tr>
                     <tr>
                       
                        <th>
                            修程：
                        </th>
                        <td>
                            <asp:TextBox ID="txtRepairProcess" name="RepairProcess" CssClass="txtSelect" runat="server"></asp:TextBox>
                        </td>
                        <th>
                          
                        </th>
                        <td colspan="3">
                          
                        </td>
                    </tr>
                </table>
            </SearchConditionTemplate>                      
        </web:search>        
    </div>

    <div class="datalist">
	    <!-- 标题头 -->
	    <h2 style="height:30px;">
				 配送计划详细页面
	    </h2>
	    <!-- 工具栏 -->
	    <div class="toolbar"  style="height:30px;">
            <asp:LinkButton ID="LinkButton2" runat="server" OnClick="LinkButtonExport_Click">
                <span>
                    <img id="Img2" alt="" runat="server" src="~/Images/icon_excel.gif" style="border: 0px" />导出
                </span>
            </asp:LinkButton>
            <%if (this.isAdmin)
              {
                    %>
            <asp:LinkButton ID="LinkButton1" runat="server"
                OnClientClick="return openEditor(this, 'Insert');" OnClick="SearchGrid">
                <span>
                    <img alt="" runat="server" id="img1" src="~/Images/icon_new.gif" style="border: 0px" />新建
                </span>
            </asp:LinkButton>  
           <% }%>      
            <% if(this.isPSS) {    
             %>
              <asp:LinkButton ID="LinkButton3" runat="server" OnClientClick="return confirm('您确认已配送下列清单了吗？')" OnClick="submitOK">
                <span>
                    <img alt="" runat="server" id="img3" src="~/Images/ico_ok.gif" style="border: 0px" />确认
                </span>
            </asp:LinkButton> 
             <% }%>   
	    </div>
	    <div class="datagrid"  style="clear:left;">    
            <!--------------------------- List Area --------------------------->
            <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"
                Width="100%" DataKeyNames="Id" DataSourceID="SmartDataSource1" PageSize="10" onrowdatabound="SmartGridView1_RowDataBound">
                <Columns>  
                    <asp:BoundField DataField="Time" HeaderText="填表时间" SortExpression="Time" ItemStyle-HorizontalAlign="left" />
                    <asp:BoundField DataField="MaterialsNo" HeaderText="物资编号" SortExpression="MaterialsNo" ItemStyle-HorizontalAlign="left" />
                    <asp:BoundField DataField="MaterialsName" HeaderText="物资名称"  ItemStyle-HorizontalAlign="center" SortExpression="MaterialsName"/>
                    <asp:BoundField DataField="MaterialsModel" HeaderText="物资规格（型号）" ItemStyle-HorizontalAlign="center" SortExpression="MaterialsModel"/>
                    <asp:BoundField DataField="DeliveredNum" HeaderText="数量" ItemStyle-HorizontalAlign="left" SortExpression="DeliveredNum" />
                    <asp:BoundField DataField="unit" HeaderText="计量单位" ItemStyle-HorizontalAlign="left" SortExpression="unit"/>
                    <asp:BoundField DataField="Mtype" HeaderText="机型" ItemStyle-HorizontalAlign="left" SortExpression="Mtype"/>
                    <asp:BoundField DataField="Remark" HeaderText="备注" ItemStyle-HorizontalAlign="left" SortExpression="Remark" />
                    <asp:TemplateField HeaderText="操作">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Wrap="False" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <table width="46px">
                                <tr>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton ID="ibtnEdit" runat="server" ToolTip="修改" _KeyId='<%#Eval("Id")%>'
                                            ImageUrl="~/images/com/dg_edit.gif" CausesValidation="False" OnClientClick="return openEditor(this, 'Edit');" OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton ID="ibtnDelete" runat="server" ToolTip="删除" ImageUrl="~/images/com/dg_del.gif" _KeyId='<%#Eval("Id")%>'
                                          OnClientClick="return confirm('您确认要删除吗?')" OnClick="DeleteDictionaryItem">
                                        </asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings />
                <EditRowStyle HorizontalAlign="Center" />
            </web:SmartGridView>
    
            <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="DistributePlanDetail.list" SelectCountCommand="DistributePlanDetail.list.count"
            SelectCommandAutoPageWrap="true" DefaultSortExpression="Time desc">       
                        
            </web:SmartSqlDataSource>
        </div>
	</div>
     <script type="text/javascript">

         $(function () {
             $("input[id$='MgID']").val('<%= this.mgID %>');
         })
         function openEditor(_this, action) {
             var flag = '<%= this.isPSS.ToString().ToLower() %>';
             if (flag == 'false') {
                 var url = "DistributePlanDetailEdit.aspx";

                 // FormViewMode : Insert/Edit/ReadOnly
                 var params = { FormViewMode: action }
                 if (action == "Insert") {
                     params.title = "添加配送计划";
                     params.MgID = '<%= this.mgID %>';
                 } else if (action == "Edit") {
                     params.title = "编辑配送计划";
                     params.Id = _this.attributes["_KeyId"].value;
                 }
                 else if (action == "Add") {
                     url = "DistributePlanDetailEdit.aspx";
                     params.title = "新增配送计划明细";
                     params.MgID = '<%= this.mgID %>';
                 }

                 var returnValue = showCenterModalDialog(buildUrl(url, params), 800, 350);
                 if (returnValue == "true") {
                     return true;
                 }
             }
             else {
                 alert("您是配料人，不可编辑该页面！");
             }
             return false;
         }

    </script>
</asp:Content>
